package pers.gxm.strategy.exercise;

public class SortAndPrint {
    public static void main(String[] args) {
        Integer[] integers = {9, 3, 4, 123, 532, 33, 5, 6};
        SortAndPrint print = new SortAndPrint(integers, new BubbleSorter());
        print.execute();


    }
    private Comparable[] data;
    private Sorter sorter;
    public SortAndPrint(Comparable[] data, Sorter sorter){
        this.data = data;
        this.sorter = sorter;
    }

    public void execute(){
        print();
        sorter.sort(data);
        print();
    }

    public void print(){
        for(int i = 0; i < data.length ; i++){
            System.out.print(data[i] + ",");
        }
        System.out.println();
    }
}
